<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><s:text name="context.title"/></title><%@ include file="/common/meta.jsp"%>
<script type="text/javascript">

function go(obj){
	var v;
	if(obj > 0){
		//碰到重复的时候，路过
		v = $("#toSelect").find("option[selected=true]");
		v.each(function(inx,o){
			var f = false;
			$("#selected").find("option").each(function(ix,j){
				if(o.value == j.value){
					f = true;
					return true;
				}
				});
			if(!f){
				$("#selected").append($(o));
			}
			});
	}else{
		v = $("#selected").find("option[selected=true]");
		v.each(function(inx,o){
			var f = false;
			$("#toSelect").find("option").each(function(ix,j){
				if(o.value == j.value){
					f = true;
					return true;
				}
				});
			if(f){
				$(o).remove();
			}else{
				$("#toSelect").append($(o));
			}
			});
	//	$("#toSelect").append($("#selected").find("option[selected=selected]"));
	}
}

function goAll(obj){
	if(obj > 0 ){
		//碰到重复的时候，路过
		v = $("#toSelect").find("option");
		v.each(function(inx,o){
			var f = false;
			$("#selected").find("option").each(function(ix,j){
				if(o.value == j.value){
					f = true;
					return true;
				}
				});
			if(!f){
				$("#selected").append($(o));
			}
			});
	//	$("#selected").append($("#toSelect").find("option"));
	}else{
		v = $("#selected").find("option");
		v.each(function(inx,o){
			var f = false;
			$("#toSelect").find("option").each(function(ix,j){
				if(o.value == j.value){
					f = true;
					return true;
				}
				});
			if(f){
				$(o).remove();
			}else{
				$("#toSelect").append($(o));
			}
			});
	//	$("#toSelect").append($("#selected").find("option"));
	}
}
</script>
</head>
<body>
<br/>
<p align="center"><s:actionmessage theme="mytheme" cssClass="actionMessage"/></p>

<form id="inputForm" action="group.action" method="post">
<s:token></s:token>
<input type="hidden" name="id" value="${team.id }"/>
<h1 class="title01"><img src="${ctx}/images/02_15.gif" width="45" height="42" class="fl"/>设置<s:if test="team.subTeam != null">小组</s:if><s:else>团队</s:else>负责人</h1>
<fieldset class="fs_ys">
		<legend><s:if test="team.subTeam != null">小组名:</s:if><s:else>团队名:</s:else>${team.groupName }</legend>
	<h3></h3>
	<table>
		<tr>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
			<td>已选&nbsp;</td>
		</tr>
		<tr>
			<td><p></p>
				<select id="toSelect" multiple="multiple" style="width: 150px;height: 280px">
					<s:iterator value="team.teacherSet">
						<option value="${v.id }">${v.teacherName }</option>
					</s:iterator>
				</select>
			&nbsp;</td>
			<td>
				<p><input type="button" value=" ->" onclick="go(1)"/></p><br/>
				<p><input type="button" value="=>" onclick="goAll(1)"/></p><br/><br/>
				<p><input type="button" value=" <-" onclick="go(-1);"/></p><br/>
				<p><input type="button" value="<=" onclick="goAll(-1)"/></p>
			&nbsp;</td>
			<td>
				<select id="selected" name="checkedTeachers" multiple="multiple" class="" style="width: 150px;height: 280px">
					<s:iterator value="team.teacherList" var="v">
						<s:if test="#v.isMaster == 1">
							<option value="${v.id }">${v.teacherName }</option>
						</s:if>
					</s:iterator>
				</select>
			&nbsp;</td>
		</tr>
	</table>
<p align="center"><input type="submit" onclick='$("#selected").find("option").attr("selected","selected")' value="  提 交" name="method:memberSave"/>  <input type="reset" onclick="history.back();" value="  取 消" /></p>
</fieldset>
</form>
</body>

</html>